package com.hainatong.shiphelper.mainhome.fragment;

import com.blankj.utilcode.util.StringUtils;
import com.hainatong.shiphelper.MvvmLazyFragment;
import com.hainatong.shiphelper.R;
import com.hainatong.shiphelper.databinding.FragmentYanxiContentDetailBinding;
import com.hainatong.shiphelper.mainhome.YanxiActivity;
import com.hainatong.shiphelper.module.warehouse.viewmodel.WareHouseViewModel;
import com.hainatong.shiphelper.utils.GsonUtil;
import com.hainatong.shiphelper.widget.LoadingDialog;
import com.hainatong.mvvmbase.rxbus.RxBusBaseMessage;

import android.os.Bundle;
import android.view.View;

/**
 * 演习的步骤详情
 */
public class YanxiDetailFragment extends MvvmLazyFragment<FragmentYanxiContentDetailBinding, WareHouseViewModel>
{
    private static String COMMON_RESULT_TYPE = "CommonResultFragment";


    private String mResultType ;

    private RxBusBaseMessage rxMsg;

    private LoadingDialog loading;

    public static YanxiDetailFragment newInstance(String resultType )
    {
        YanxiDetailFragment resultFragment = new YanxiDetailFragment();
        Bundle bundle = new Bundle();
        bundle.putString(COMMON_RESULT_TYPE,resultType);
        resultFragment.setArguments(bundle);
        return resultFragment;
    }


    @Override
    protected void initParameters()
    {
        Bundle args = getArguments();
        if( args != null && args.size() > 0)
        {
            mResultType = args.getString(COMMON_RESULT_TYPE , "");

            if( !StringUtils.isEmpty( mResultType ))
            {
                rxMsg = GsonUtil.json2Obj( mResultType ,RxBusBaseMessage.class );
            }
        }
    }

    @Override
    public int getLayoutId()
    {
        return R.layout.fragment_yanxi_content_detail;
    }

    @Override
    public int getBindingVariable()
    {
        return 0;
    }

    @Override
    protected void onRetryBtnClick()
    {
    }

    @Override
    protected void initView(View view)
    {
        loading = new LoadingDialog( getActivity() , getString( R.string.loading ) );

        viewDataBinding.tvContentStepTag.setText( "第二步" );

        viewDataBinding.btnNext.setOnClickListener( v -> {
            YanxiActivity.startByParam(getActivity(),"yanxiBean");

        } );

    }

    @Override
    protected void lazyLoad()
    {

    }

}
